package cl.whyem.spring.integration.mail.spring;

import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.search.FlagTerm;
import javax.mail.search.SearchTerm;
import org.springframework.integration.mail.SearchTermStrategy;

/**
 * Termino de busqueda customizado, obtiene solo correos no leidos.
 */
public class CustomSearchTermStrategy implements SearchTermStrategy {

    @Override
    public SearchTerm generateSearchTerm(Flags supportedFlags, Folder folder) {
        SearchTerm st = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
        return st;
    }

}
